﻿Imports System.Collections.Generic
Imports System.Linq
Imports DevComponents.Editors.DateTimeAdv
Imports DoAnQuanLyBanHang1065043_1065007.DoAnQuanLyBanHang.DTO
Imports DoAnQuanLyBanHang1065043_1065007.DoAnQuanLyBanHang.General
Imports System.Data
Imports System.Text
Imports System.Windows.Forms
Imports DevComponents.DotNetBar.Controls

Namespace DoAnQuanLyBanHang.DAO
    Public Class LoaiTienCtrl
        Private m_LoaiTienData As New LoaiTienData()



#Region "Hien thi"

        Public Sub HienThiComboBox(cbx As ComboBox)
            cbx.DataSource = m_LoaiTienData.LayLoaiTien()
            cbx.DisplayMember = "LoaiTien"
            cbx.ValueMember = "MaLoaiTien"
        End Sub

        Public Sub HienThiDataGridViewComboBoxColumn(cmbColumn As DataGridViewComboBoxColumn)
            cmbColumn.DataSource = m_LoaiTienData.LayLoaiTien()
            cmbColumn.DisplayMember = "LoaiTien"
            cmbColumn.ValueMember = "MaLoaiTien"
            cmbColumn.DataPropertyName = "MaLoaiTien"
            cmbColumn.HeaderText = "Loại Tiền"
        End Sub
#End Region

#Region "hien thi"
        Public Sub HienThi(Dgv As DataGridView, bvn As BindingNavigator)
            Dim bs As New BindingSource()

            bs.DataSource = m_LoaiTienData.LayLoaiTien()
            bvn.BindingSource = bs
            Dgv.DataSource = bs
        End Sub

        Public Sub HienThi(dGV As DataGridViewX, bN As BindingNavigator, txtMaLoaiTien As TextBoxX, txtLoaiTien As TextBoxX)
            Dim bS As New BindingSource()
            bS.DataSource = m_LoaiTienData.LayLoaiTien()

            txtMaLoaiTien.DataBindings.Clear()
            txtMaLoaiTien.DataBindings.Add("Text", bS, "MaLoaiTien")

            txtLoaiTien.DataBindings.Clear()
            txtLoaiTien.DataBindings.Add("Text", bS, "LoaiTien")

            bN.BindingSource = bS
            dGV.DataSource = bS
        End Sub
#End Region

#Region "Them moi"
        Public Function ThemDongMoi() As DataRow
            Return m_LoaiTienData.ThemDongMoi()
        End Function
        Public Sub ThemMoi(m_Row As DataRow)
            m_LoaiTienData.ThemLoaiTien(m_Row)
        End Sub
#End Region

#Region "Luu"
        Public Function LuuLoaiTien() As Boolean
            Return m_LoaiTienData.LuuLoaiTien()
        End Function
#End Region
    End Class
End Namespace
